<?php

namespace app\model\not_del;

use app\model\RatingScaleFactorModel;
use think\Model;
use think\model\relation\BelongsTo;

/**
 * 代理测评因子得分（他人代测）
 */
class ProxyFactorScoreModel extends Model
{
    protected $name = 'proxy_factor_score';

    /**
     * 关联量表因子-四合一
     * @return BelongsTo
     */
    public function fourInOneRatingScaleFactor(): BelongsTo
    {
        return $this->belongsTo(RatingScaleFactorModel::class, 'factor_id')->bind([
            'factor_name' => 'name',
        ]);
    }

    /**
     * 关联量表因子
     * @return BelongsTo
     */
    public function RatingScaleFactor(): BelongsTo
    {
        return $this->belongsTo(RatingScaleFactorModel::class, 'factor_id')->bind([
            'factor_name' => 'name',
            'formula_method',
            'factor_explain',
            'rating_scale_factor_level'
        ]);
    }

    /**
     * 关联量表因子等级
     * @return BelongsTo
     */
    public function RatingScaleFactorLevel(): BelongsTo
    {
        return $this->belongsTo(RatingScaleFactorLevelModel::class, 'factor_level_id')->bind([
            'factor_level_name' => 'name',
            'overview',
            'explain',
            'low_range',
            'high_range'
        ]);
    }
}